test(build-std): Add test for LTO#16277
Merged
weihanglo merged 1 commit intorust-lang:masterfrom Nov 20, 2025
Merged
Conversation
Collaborator
weihanglo
reviewed
Nov 19, 2025
Member
There was a problem hiding this comment.
Would you mind briefly explaining (or copy) the regression a bit in the PR description as well?
Member
There was a problem hiding this comment.
Would also be helpful to have a code comment around the test, as the test has a bit of distance from Cargo itself.
Member
There was a problem hiding this comment.
Thanks for providing the context!
a32e55d to
374368d
Compare
weihanglo
approved these changes
Nov 20, 2025
Member
There was a problem hiding this comment.
Thanks for providing the context!
bors
added a commit
to rust-lang/rust
that referenced
this pull request
Nov 22, 2025
Update cargo submodule 7 commits in 5c0343317ce45d2ec17ecf41eaa473a02d73e29c..9fa462fe3a81e07e0bfdcc75c29d312c55113ebb 2025-11-18 19:05:44 +0000 to 2025-11-21 20:49:51 +0000 - Enable CARGO_CFG_DEBUG_ASSERTIONS in build scripts based on profile (rust-lang/cargo#16160) - fix(config-include): disallow glob and template syntax (rust-lang/cargo#16285) - test(config-include): include always relative to including config (rust-lang/cargo#16286) - docs(guide): When suggesting alt dev profile, link to related issue (rust-lang/cargo#16275) - refactor(timings): separate data collection and presentation (rust-lang/cargo#16282) - test(build-std): Add test for LTO (rust-lang/cargo#16277) - fix(bindeps): do not propagate artifact dependency to proc macro or build deps (rust-lang/cargo#15788) r? ghost
Zalathar
added a commit
to Zalathar/rust
that referenced
this pull request
Dec 9, 2025
…to, r=jieyouxu test: Add a test for 146133 This is a test without using `-Zbuild-std` for rust-lang#146133. There is another test using `-Zbuild-std`: rust-lang/cargo#16277. Even if a crate is marked as `#![no_builtins]`, we can still generate bitcode for rlib, but we cannot emit bitcode to the linker in rustc's LTO.
matthiaskrgr
added a commit
to matthiaskrgr/rust
that referenced
this pull request
Dec 9, 2025
…to, r=jieyouxu test: Add a test for 146133 This is a test without using `-Zbuild-std` for rust-lang#146133. There is another test using `-Zbuild-std`: rust-lang/cargo#16277. Even if a crate is marked as `#![no_builtins]`, we can still generate bitcode for rlib, but we cannot emit bitcode to the linker in rustc's LTO.
rust-timer
added a commit
to rust-lang/rust
that referenced
this pull request
Dec 9, 2025
Rollup merge of #149772 - dianqk:no-builtins-linker-plugin-lto, r=jieyouxu test: Add a test for 146133 This is a test without using `-Zbuild-std` for #146133. There is another test using `-Zbuild-std`: rust-lang/cargo#16277. Even if a crate is marked as `#![no_builtins]`, we can still generate bitcode for rlib, but we cannot emit bitcode to the linker in rustc's LTO.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Add a test for rust-lang/rust#146133.
cargo +nightly-2025-08-29 test --test build-std -- ltocan reproduce the regression.This is not a bug from Cargo, but it requires
-Zbuild-stdin most use cases.The test case is from rust-lang/rust#146109. The point is that when rustc is invoked with -Clto=fat or -Clto=thin, it should perform LTO with ALL bitcodes. However, rust-lang/rust#145368 emits bitcodes for compiler_builtins but excludes it from LTO participation.
As a result, the compiler_builtins bitcodes library is passed to the linker, but the linkers, such as the GNU ld or older versions of LLD, are unable to process bitcodes.